#!/bin/sh

if [ -z "$IPKG_OFFLINE_ROOT" ]; then
  echo "/usr/sbin/rootfs_open -w" > /var/remount.sh
  sh /var/remount.sh
  if [ $? -ne 0 ]; then
  	echo "Error remounting root partition read-write."
  	echo "Reboot device then try installing again."
  	exit 1
  fi
fi

/bin/rm -f /usr/lib/luna/java/SysToolsMgr.jar

/bin/rm -f /usr/share/dbus-1/system-services/cz.karry.vpnc

/bin/rm -f /etc/event.d/cz.karry.vpnc

## remove vpnbox directory
umount -f /opt/vpnbox/etc
umount -f /opt/vpnbox/proc
/bin/rm -rf /opt/vpnbox

## revert /etc/resolv.conf symlink
ln -sf /var/run/resolv.conf /etc/resolv.conf

if [ -z "$IPKG_OFFLINE_ROOT" ]; then
  killall -9 java
  mount -o remount,ro /
fi

exit 0
